<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8"> 
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <meta name="apple-mobile-web-app-capable" content="yes" />

        <!-- Base Css Files -->
        <link href="__PUBLIC__/statics/coco-chat/assets/libs/jqueryui/ui-lightness/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" />
        <link href="__PUBLIC__/statics/coco-chat/assets/libs/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
        <link href="__PUBLIC__/statics/coco-chat/assets/libs/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
        <link href="__PUBLIC__/statics/coco-chat/assets/libs/fontello/css/fontello.css" rel="stylesheet" />
        <link href="__PUBLIC__/statics/coco-chat/assets/libs/animate-css/animate.min.css" rel="stylesheet" />
        <link href="__PUBLIC__/statics/coco-chat/assets/libs/nifty-modal/css/component.css" rel="stylesheet" />
        <link href="__PUBLIC__/statics/coco-chat/assets/libs/magnific-popup/magnific-popup.css" rel="stylesheet" /> 
        <link href="__PUBLIC__/statics/coco-chat/assets/css/style.css" rel="stylesheet" type="text/css" />
        <link href="__PUBLIC__/statics/coco-chat/assets/css/style-responsive.css" rel="stylesheet" />
        <link href="__PUBLIC__/statics/coco-chat/assets/libs/pace/pace.css" rel="stylesheet" />
        <link href="__PUBLIC__/statics/coco-chat/assets/libs/jquery-notifyjs/styles/metro/notify-metro.css" rel="stylesheet" type="text/css" />
        
        <!-- Extra CSS Files -->
      	<link href="__PUBLIC__/statics/coco-chat/assets/libs/bootstrap-select/bootstrap-select.min.css" rel="stylesheet" type="text/css" />
        
        <!-- Custom Css Files -->
        <link href="__ADMIN_CSS__/style.css"  rel="stylesheet" />
    </head>
    
    <body>
	<!-- Begin page -->
	<div>
        <div class="sub-header-title">
            <h2>会员列表</h2>
        </div>
        <form method="post" class="form-horizontal" action="{:U('User/index')}">
       		<div class="form-group">
				<div class="col-sm-2">
					<select class="form-control selectpicker" name="level">
						<option value="-1">全部会员级别</option>
						<volist name="levelList" id="v">
							<option value="{$v['id']}" <if condition="$level eq $v['id']">selected</if>>{$v['title']}</option>
						</volist>
					</select>
				</div>
	         	<div class="col-sm-2">
	             	<select class="form-control selectpicker" name="status">
	                  	<option value="-1">全部激活状态</option>
	                  		<option value="0" <if condition="$status eq '0'">selected</if>>未激活</option>
	                  		<option value="1" <if condition="$status eq '1'">selected</if>>已激活</option>
	                </select>
	            </div>
	  			<div class="col-sm-2">
	        		<div class="input-group">
                     	<span class="input-group-addon">日期</span>
                     	<input type="text" class="form-control" id="date-start" name="start_date" value="{$start_date}" placeholder="开始日期"/>
                 	</div>
	           	</div>
	          	<div class="col-sm-2">
             		<div class="input-group">
	                    <span class="input-group-addon">-</span>
	                  	<input type="text" class="form-control" id="data-end" name="end_date" value="{$end_date}" placeholder="截止日期"/>
	              	</div>
	       		</div>
	       		<div class="col-sm-2">
	               	<input class="form-control" placeholder="根据会员编号搜索" value="{$keyword}" name="keyword" type="text">
	            </div>
	            <div class="col-sm-2">
	                <button class="btn btn-success" type="submit">查询</button>
	            </div>
	        </div>
        </form>
    </div>
    <div class="widget">
        <div class="widget-content">

           	<table class="table table-bordered table-striped">
                <thead>
				<tr>

					<th>会员信息</th>
					<th>账户信息</th>
					<th>其他信息</th>
					<th>业绩</th>
					<th>状态</th>
					<th>注册时间</th>
					<th>操作</th>
				</tr>
                </thead>
                <tbody>
                	<volist name="list" id="vo">
						<tr>
							<td>
								编号: <a href="{:U('User/login',array('user_no'=>$vo['user_no']))}" target="_blank">{$vo.user_no}</a><br/>
								真实姓名:{$vo.realname}<br/>
								手机号:{$vo.phone}<br/>
								级别:{$vo.title}<br/>

							</td>
							<td>
								注册币:{$vo.eb_account}<br/>
								现金:{$vo.cb_account}<br/>
								奖金:{$vo.mb_account}<br/>
								购物币:{$vo.tb_account}<br/>
								返利:{$vo.rb_account}<br/>
							</td>
							<td>
								安置人: <a href="{:U('User/login',array('user_no'=>$vo['parent_no']))}" target="_blank">{$vo.parent_no}</a><br/>
								推荐人: <a href="{:U('User/login',array('user_no'=>$vo['recommend_no']))}" target="_blank">{$vo.recommend_no}</a><br/>
								安置区域:<if condition="$vo.location eq 1">左区<else />右区</if><br/>
								注册人:<a href="{:U('User/login',array('user_no'=>$vo['register_no']))}" target="_blank">{$vo.register_no}</a><br/>
								<if condition="$serviceCenter eq 1">报单中心:<a href="{:U('User/login',array('user_no'=>$vo['service_center_no']))}" target="_blank">{$vo.service_center_no}</a></if>
							</td>
							<td>
								投资金额:{$vo.investment}<br/>
								左区剩余业绩:{$vo.left_market}<br/>
								右区剩余业绩:{$vo.right_market}<br/>
								对碰业绩:{$vo.touch_market}

							</td>
							<td>
								激活状态:<if condition="$vo.is_activated eq 1">已激活<else />未激活</if><br/>
								锁定状态:<if condition="$vo.is_locked eq 1">锁定<else /> 正常</if><br/>
								冻结状态:<if condition="$vo.is_frozen eq 1">冻结<else /> 正常</if><br/>
							</td>
							<td>
								注册时间:{$vo.add_time}<br/>
								激活时间:{$vo.activate_time}
							</td>
							<td data-user-no="{$vo.user_no}">
								<if condition="$vo.id eq $top['id']">
									<a href="{:U('User/edit',array('user_no'=>$vo['user_no']))}">修改资料</a> |
									<a href="javascript:void(0);" class="reset-password" >重置密码</a>
								<else/>
									<a href="{:U('User/edit',array('user_no'=>$vo['user_no']))}">修改资料</a> |
									<a href="javascript:void(0);" class="reset-password" >重置密码</a> |
									<if condition="$vo.is_locked eq 1">
										<a href="javascript:void(0);" class="user-lock" data-type="0">解锁</a>
										<else />
										<a href="javascript:void(0);" class="user-lock" data-type="1">锁定</a>
									</if> |
									<a href="javascript:void(0);" class="user-delete">删除</a>
									<if condition="$vo.is_activated eq 0"> | 
										<a href="javascript:void(0);" class="user-activate" data-type="0">空激活</a>|
										<a href="javascript:void(0);" class="user-activate" data-type="1">实激活</a>
									</if>

										|<a href="{:U('User/bindListQuery',array('user_no'=>$vo['user_no']))}" >查询快捷支付</a>

								</if>
							</td>
						</tr>
                 	</volist>
            	</tbody>
            </table>
            {$page}
        </div>
    </div> 
    <!-- End of page -->
	
	<!-- Base Js Files -->
	<script src="__PUBLIC__/statics/coco-chat/assets/libs/jquery/jquery-1.11.1.min.js"></script>
	<script src="__PUBLIC__/statics/coco-chat/assets/libs/bootstrap/js/bootstrap.min.js"></script>
	<script src="__PUBLIC__/statics/coco-chat/assets/libs/jqueryui/jquery-ui-1.10.4.custom.min.js"></script>
	<script src="__PUBLIC__/statics/coco-chat/assets/libs/jquery-ui-touch/jquery.ui.touch-punch.min.js"></script>
 	<script src="__PUBLIC__/statics/coco-chat/assets/libs/jquery-detectmobile/detect.js"></script>
	<script src="__PUBLIC__/statics/coco-chat/assets/libs/fastclick/fastclick.js"></script>
	<script src="__PUBLIC__/statics/coco-chat/assets/libs/jquery-slimscroll/jquery.slimscroll.js"></script>
	<script src="__PUBLIC__/statics/coco-chat/assets/libs/nifty-modal/js/classie.js"></script>
	<script src="__PUBLIC__/statics/coco-chat/assets/libs/nifty-modal/js/modalEffects.js"></script>
	<script src="__PUBLIC__/statics/coco-chat/assets/libs/jquery-notifyjs/notify.min.js"></script>
    <script src="__PUBLIC__/statics/coco-chat/assets/libs/jquery-notifyjs/styles/metro/notify-metro-blue.js"></script>
	<script src="__PUBLIC__/statics/coco-chat/assets/libs/pace/pace.min.js"></script>
	
	<!-- Extra Js Files -->
	<script src="__PUBLIC__/statics/coco-chat/assets/libs/bootstrap-select/bootstrap-select.min.js"></script>
    <script src="__PUBLIC__/statics/coco-chat/assets/libs/bootstrap-select2/select2.min.js"></script>
    <script src="__PUBLIC__/statics/coco-chat/assets/libs/laydate/laydate.js"></script>
	
	<!-- Custom Js Files -->
	<script src="__ADMIN_JS__/common.js"></script>
	
    <script>
		var start = {
			elem: '#date-start', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
			event: 'focus', //响应事件。如果没有传入event，则按照默认的click
			max: laydate.now(), //最大日期
			choose: function(datas){
				end.min = datas; //开始日选好后，重置结束日的最小日期
				end.start = datas //将结束日的初始值设定为开始日
			}
		};
		var end = {
			elem: '#data-end', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
			event: 'focus', //响应事件。如果没有传入event，则按照默认的click
			max: laydate.now(), //最大日期
			choose: function(datas){
				start.max = datas; //结束日选好后，重置开始日的最大日期
			}
		};
		laydate(start);
		laydate(end);

		//SELECT
		$('.selectpicker').selectpicker();

		//重置密码
		$('.reset-password').click(function() {
			var user_no = $(this).parent('td').data("user-no");

			window.parent.layer.confirm('确认重置该会员的登录密码和安全码吗？', {
				btn: ['确认','取消'] //按钮
			}, function(index){
				var data = {
					'user_no'	: user_no
				};
				// 用ajax提交表单
				$.post("{:U('User/resetPassword')}", data, function(response) {
					//弹出提示
					window.parent.layer.msg(response.message);

					//根据请求相应状态提示通知
					if(response.status){
						notify("success",response.message);
						window.location.reload();
					}else{
						notify("error",response.message);
					}
				}, 'json');
				//关闭确认对话框
				window.parent.layer.close(index);
			});
		});

		//锁定/解锁
		$('.user-lock').click(function() {
			var user_no = $(this).parent('td').data("user-no");
			var type = $(this).data("type");

			var type_name = '解锁';
			if (type==1) {
				type_name = '锁定';
			}
			
			window.parent.layer.confirm('确认'+type_name+'该会员吗？', {
				btn: ['确认','取消'] //按钮
			}, function(index){
				var data = {
					'user_no'	: user_no,
					'is_locked'	: type
				};
				// 用ajax提交表单
				$.post("{:U('User/setLock')}", data, function(response) {
					//弹出提示
					window.parent.layer.msg(response.message);

					//根据请求相应状态提示通知
					if(response.status){
						notify("success",response.message);
						window.location.reload();
					}else{
						notify("error",response.message);
					}
				}, 'json');
				//关闭确认对话框
				window.parent.layer.close(index);
			});
		});

		//删除会员
		$('.user-delete').click(function() {
			var user_no = $(this).parent('td').data("user-no");
			
			window.parent.layer.confirm('删除后将无法恢复，确认删除该会员吗？', {
				btn: ['确认','取消'] //按钮
			}, function(index){
				//开启数据处理提示
				var load = window.parent.layer.msg('数据保存中。。。', {
							  icon: 16,
							  shade: 0.5,
							  time: 0,
							});
				
				var data = {
					'user_no'	: user_no
				};
				// 用ajax提交表单
				$.post("{:U('User/userDelete')}", data, function(response) {
					//关闭数据处理提示
					window.parent.layer.close(load);
					//弹出提示
					window.parent.layer.msg(response.message);

					//根据请求相应状态提示通知
					if(response.status){
						notify("success",response.message);
						window.location.reload();
					}else{
						notify("error",response.message);
					}
				}, 'json');
				//关闭确认对话框
				window.parent.layer.close(index);
			});
		});
		
		//会员激活
		$('.user-activate').click(function() {
			var user_no = $(this).parent('td').data("user-no");
			var type = $(this).data("type");

			var type_name = '空激活';
			if (type==1) {
				type_name = '实激活';
			}
			window.parent.layer.confirm('确认'+type_name+'该会员吗？', {
				btn: ['确认','取消'] //按钮
			}, function(index){
				//开启数据处理提示
				var load = window.parent.layer.msg('数据保存中。。。', {
							  icon: 16,
							  shade: 0.5,
							  time: 0,
							});
				
				var data = {
					'user_no'		: user_no,
					'is_activated'	: type
				};
				// 用ajax提交表单
				$.post("{:U('User/userActivate')}", data, function(response) {
					//关闭数据处理提示
					window.parent.layer.close(load);
					//弹出提示
					window.parent.layer.msg(response.message);

					//根据请求相应状态提示通知
					if(response.status){
						notify("success",response.message);
						window.location.reload();
					}else{
						notify("error",response.message);
					}
				}, 'json');
				//关闭确认对话框
				window.parent.layer.close(index);
			});
		});
	</script>
	</body>
</html>
